package frog.lazy.framework.core.tools;

import cn.hutool.core.util.NumberUtil;

import java.util.Random;

public class NumberUtils extends NumberUtil {

    private static final Random ran = new Random();

    public static String generateRandomNumber(int min, int max){
        return String.valueOf(ran.ints(min, (max + 1)).limit(1).findFirst().getAsInt());
    }

    public static void main(String[] args) {
        Long start = System.currentTimeMillis();
        for(int i = 0; i < 10000; i++)
            generateRandomNumber(1000,9999);
        System.out.println(System.currentTimeMillis() - start);
        start = System.currentTimeMillis();
        for(int i = 0; i < 10000; i++)
            generateRandomNumber(1000, 9999, 4);
        System.out.println(System.currentTimeMillis() - start);
    }
}
